package com.neusoft.controller;

import com.neusoft.bean.Perform;
//import com.neusoft.bean.Singer;
import com.neusoft.exception.MyException;
import com.neusoft.response.ApiResponse;
import com.neusoft.service.IArticleService;
import com.neusoft.utils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class HelloController {
//    Perform tmp = new Singer();
//    @Autowired
//    Perform tmp;
    @Autowired
    IArticleService iArticleService;
    @GetMapping("/hello")
    public ApiResponse<String> hello() throws MyException {
        System.out.println("hello");
        iArticleService.processArticle();
//        tmp.perform();
//        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
//        Perform tmp = (Perform)context.getBean("zhangsan");
        Perform tmp = BeanUtils.getBean("zhangsan");
        tmp.perform();
        return ApiResponse.success("hello spring");
    }
}
